package com.zl.learning.io;

import java.io.Console;

/**
 * {@link Console} 只能在命令行中使用
 * 在编译中报空指针
 */
public class TestConsole {
    public static void main(String[] args) {
        Console console = System.console();
        String username = console.readLine("请输入用户名：");
        char[] pass = console.readPassword("请输入密码：");
        console.printf(username);
        console.printf(new String(pass));
        System.out.printf("%-9s %-9s\n","中国人","安的士大夫的说");
        System.out.printf("%-9s %-9s\n","人","法");
        System.out.printf("%-9s %-9s\n","中人","法沙发上上帝发誓放大手动阀手动阀");
    }
}
